<!DOCTYPE html>
<html>

<head>
    <meta charset='UTF-8'>
    <meta name='viewport' content='width=device-width,initial-scale=1.0'>
    <meta http-equiv='X-UA-Compatible' content='ie=edge'>
    <title>Document</title>
</head>

<body>
    <div id='app'>
        <span-btn></span-btn>
        <span-btn></span-btn>
        <span-btn></span-btn>
        <span-btn></span-btn>
        <span-btn></span-btn>

    </div>
    <script src='./vue.js'></script>
    <script>
        // 组件:封装的html css js
        // 组件分类: 全局组件 局部组件
        // 全局组件
        // Vue.filter
        // Vue.directive
        // Vue.component('组件的名字',{})
        Vue.component('span-btn', {
            // template是组件自带的选项 作用是 写标签结构
            template: `
            <div>
                <span>{{count}}</span>
                <button @click="changeCount">按钮</button>
                <br>
            </div>`,
            data() {
                return {
                    count: 0
                }
            },
            methods: {
                changeCount() {
                    this.count++;
                }
            }



        });
        new Vue({
            el: '#app',
            data: {

            },
            methods: {

            }
        });
    </script>
</body>

</html>